#!/bin/bash
./install_aarch64.sh

sudo tunctl -u root -t tap0
sudo ifconfig tap0 192.168.1.1 promisc up
sudo route add -net 192.168.1.0 netmask 255.255.255.0 dev tap0
sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE
sudo netfilter-persistent save

sudo qemu-system-aarch64 \
	-M virt \
	-cpu cortex-a57 \
	-smp 4 \
	-m 1024M \
    -kernel ./aarch64-virt/arch/arm64/boot/Image \
	-netdev tap,id=net0,ifname=tap0,script=no \
	-device virtio-net-pci,netdev=net0 \
	-nographic \
    -append "root=/dev/nfs rw nfsroot=192.168.1.1:/sync/rootfs_aarch64,proto=tcp,nfsvers=3,nolock console=ttyAMA0 ip=192.168.1.100 init=/linuxrc" \
	#-sd ./rootfs-aarch64.ext4 \
